import {
    Component,
    EventEmitter,
    Input,
    OnChanges,
    OnInit,
    Output,
    ViewChild
} from '@angular/core';
import { ImageSliderComponent } from '../image-slider';
export interface TopMenu {
    title: string;
    link?: string;
}

@Component({
    selector: 'app-scrollable-tab',
    templateUrl: './scrollable-tab.component.html',
    styleUrls: ['./scrollable-tab.component.css']
})
export class ScrollableTabComponent implements OnInit, OnChanges {
    @Input() private menus: TopMenu[] = [];
    @Input() private backgroundColor = '#fff';
    @Input() private titleActiveColor = 'yellow';
    @Input() private titleColor = 'blue';
    @Input() private indicatorColor = 'yellow';
    @Output() private tabSelected = new EventEmitter();

    private selectedIndex = -1;
    //
    public constructor() {}
    //
    public ngOnInit() {}

    public ngOnChanges() {}

    /**
     * 点击tab事件
     * @param index 1
     */
    private handleSelection(index: number) {
        this.selectedIndex = index;
        this.tabSelected.emit(this.menus[index]);
    }
}
